﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XEvents.Library
{
    /// <summary>
    /// Event Tracing for Windows Keyword Mapping
    /// </summary>
    public enum Keyword : int
    {
        process = 1,
        scheduling = 2,
        io = 4,
        memory = 8,
        exception = 16,
        synchronization = 32
    }

    /// <summary>
    /// Event Tracing for Windows Channels Mapping
    /// </summary>
    public enum Channel : int
    {
        Admin = 1,
        Analytic = 2,
        Debug = 3,
        Operational = 4
    }

    /// <summary>
    /// Column Type Definition
    /// </summary>
    public enum ColumnType
    {
        Customizable,
        Data,
        Readonly,
    }

    /// <summary>
    /// Specifies whether or not causality is tracked. If enabled, causality 
    /// allows related events on different server connections to be correlated 
    /// together.
    /// </summary>
    public enum TrackCausality : int
    {
        /// <summary>
        ///  Tracking is disabled.
        /// </summary>
        OFF = 0,
        /// <summary>
        ///  Tracking is enabled and related events on different server connections can be correlated.
        /// </summary>
        ON = 1
    }

    /// <summary>
    /// Specifies whether or not to start this event session automatically when 
    /// SQL Server starts.
    /// </summary>
    public enum StartupState : int
    {
        /// <summary>
        /// The session does not start when the server starts.
        /// </summary>
        OFF = 0,
        /// <summary>
        /// The event session starts when the server starts.
        /// </summary>
        ON = 1
    }

    /// <summary>
    /// The location in memory where event buffers are created. 
    /// </summary>
    public enum MemoryPartitionMode
    {
        /// <summary>
        /// A single set of buffers are created within a SQL Server instance.
        /// </summary>
        NONE,
        /// <summary>
        /// A set of buffers is created for each CPU.
        /// </summary>
        PER_CPU,
        /// <summary>
        /// A set of buffers is created for each non-uniform memory access (NUMA) node.
        /// </summary>
        PER_NODE
    }

    /// <summary>
    /// Determines how event loss is handled. 
    /// </summary>
    public enum EventRetentionMode
    {
        /// <summary>
        /// Events can be lost from the session. Single events are dropped only 
        /// when all event buffers are full. Losing single events when buffers 
        /// are full allows for acceptable SQL Server performance characteristics, 
        /// while minimizing the loss in the processed event stream.
        /// </summary>
        ALLOW_SINGLE_EVENT_LOSS,
        /// <summary>
        /// Full event buffers can be lost from the session. The number of events 
        /// lost depends on the memory size allocated to the session, the 
        /// partitioning of the memory, and the size of the events in the buffer. 
        /// This option minimizes performance impact on the server when event 
        /// buffers are quickly filled. However, large numbers of events can be 
        /// lost from the session.
        /// </summary>
        ALLOW_MULTIPLE_EVENT_LOSS,
        /// <summary>
        /// No event loss is allowed. This option ensures that all events raised 
        /// are retained. Using this option forces all the tasks that fire events 
        /// to wait until space is available in an event buffer. This may lead to 
        /// detectable performance degradation while the event session is active.
        /// </summary>
        NO_EVENT_LOSS
    }

    public enum PredicateType
    {
        Comparator,
        Source
    }

    /// <summary>
    /// Returns the State of the Event Session
    /// </summary>
    public enum SessionState : int
    {
        /// <summary>
        /// Started
        /// </summary>
        Start = 1,

        /// <summary>
        /// Stopped
        /// </summary>
        Stop = 0
    }
}